﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="LiteralsHelper.cs" company="Spenta Consulting">
//   (c) Copyright 2011
// </copyright>
// <summary>
//   Defines the LiteralsHelper type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Spenta.StreetCare.Silverlight.Resources
{
    using System.ComponentModel;
    using System.Globalization;

    /// <summary>
    /// Defines the LiteralsHelper type.
    /// </summary>
    public class LiteralsHelper : INotifyPropertyChanged 
    {
        /// <summary>
        /// Private store for the listeals property
        /// </summary>
        private static readonly StreetCare PrivateLiterals = new StreetCare();

        /// <summary>
        /// Occurs when a property value changes.
        /// </summary>
        public event PropertyChangedEventHandler PropertyChanged;

        /// <summary>
        /// Gets the literals.
        /// </summary>
        public static StreetCare Literals
        {
            get { return PrivateLiterals; }
        }

        /// <summary>
        /// Gets or sets the culture info.
        /// </summary>
        /// <value>
        /// The culture info.
        /// </value>
        public CultureInfo CultureInfo
        {
            get
            {
                return StreetCare.Culture;
            }

            set
            {
                StreetCare.Culture = value;
                this.NotifyThatEverythingChanged();
            }
        }

        /// <summary>
        /// Notifies the that everything changed.
        /// </summary>
        public void NotifyThatEverythingChanged()
        {
            this.OnPropertyChanged(string.Empty);
        }

        /// <summary>
        /// Called when [property changed].
        /// </summary>
        /// <param name="propertyName">Name of the property.</param>
        protected void OnPropertyChanged(string propertyName)
        {
            var handlers = this.PropertyChanged;
            if (handlers != null)
            {
                handlers(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
